<%@ page language="java" import="java.util.*,java.text.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    
    <title>教室课表</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<script type="text/javascript" src="<%=path%>/js/jQuery/jquery-1.6.min.js"></script>
	<script type="text/javascript">
	 	$(document).ready(function(){
	 		var newwin = window.dialogArguments;
	 		var classroomSplit = newwin.split(",");
	 		var classroomId = classroomSplit[0];
	 		var classroomName = classroomSplit[1];
	 		$("#PrintName").val(classroomName);
	 		$("#classroomName").html(classroomName);
	 		$("#printRemark").val($("#remark").html());
	 		$("#printTime").val($("#time").html());
	 		//alert($("#time").html());
	 		//$("#title").val($("#scheduleName").html());
	 		//alert($("#title").val());
	 		//$("#title").val($("#scheduleName").val());
	 		//alert($("#flagAll").val()+"-"+$("#classroomPrint").val());
	 		//alert(classroomId+","+classroomName);
	 		var nextvalue;
	 		var par;
	 		var flag = "";
	 		if(classroomId==""||classroomId==null||classroomId=="undefined"||isNaN(classroomId)){
	 			alert("没有得到教室信息！");
	 			return false;
	 		}else{
	 			$.ajax({
						url: '/schedule/queryPaikeByClassroomId',
						data: "flag="+classroomId,
						type: "POST",
						success:function(data){
								$(data.root).each(function(index,scheduleByClass){
									//alert(scheduleByClass.classId);
									var classroomId = scheduleByClass.classroomId;
									if(scheduleByClass.j01.classId!=0){
										var j01 = scheduleByClass.j01;
										$("#j01").html("<input type = 'hidden' value ='j01-"+j01.scheduleId+"' /><div align ='center' id='courses'>"+j01.courseName+"&nbsp; ("+j01.totalTime+")<br>(1-"+j01.weeks+j01.teacherName+"&nbsp;"+j01.classroomName+"</div>");
									};
									var j02 = scheduleByClass.j02;
									if(j02.classId!=0){
										$("#j02").html("<input type = 'hidden' value ='j02-"+j02.scheduleId+"' /><div align ='center' id='courses'>"+j02.courseName+"&nbsp; ("+j02.totalTime+")<br>(1-"+j02.weeks+j02.teacherName+"&nbsp;"+j02.classroomName+"</div>");
									};
									var j03 = scheduleByClass.j03;
									if(j03.classId!=0){
										$("#j03").html("<input type = 'hidden' value ='j03-"+j03.scheduleId+"' /><div align ='center' id='courses'>"+j03.courseName+"&nbsp;("+j03.totalTime+")<br>(1-"+j03.weeks+j03.teacherName+"&nbsp;"+j03.classroomName+"</div>");
									};
									var j04 = scheduleByClass.j04;
									if(j04.classId!=0){
										$("#j04").html("<input type = 'hidden' value ='j04-"+j04.scheduleId+"' /><div align ='center' id='courses'>"+j04.courseName+"&nbsp; ("+j04.totalTime+")<br>(1-"+j04.weeks+j04.teacherName+"&nbsp;"+j04.classroomName+"</div>");
									};
									var j05 = scheduleByClass.j05;
									if(j05.classId!=0){
										$("#j05").html("<input type = 'hidden' value ='j05-"+j05.scheduleId+"' /><div align ='center' id='courses'>"+j05.courseName+"&nbsp; ("+j05.totalTime+")<br>(1-"+j05.weeks+j05.teacherName+"&nbsp;"+j05.classroomName+"</div>");
									};
									var j06 = scheduleByClass.j06;
									if(j06.classId!=0){
										$("#j06").html("<input type = 'hidden' value ='j06-"+j06.scheduleId+"' /><div align ='center' id='courses'>"+j06.courseName+"&nbsp; ("+j06.totalTime+")<br>(1-"+j06.weeks+j06.teacherName+"&nbsp;"+j06.classroomName+"</div>");
									};
									var j07 = scheduleByClass.j07;
									if(j07.classId!=0){
										$("#j07").html("<input type = 'hidden' value ='j07-"+j07.scheduleId+"' /><div align ='center' id='courses'>"+j07.courseName+"&nbsp; ("+j07.totalTime+")<br>(1-"+j07.weeks+j07.teacherName+"&nbsp;"+j07.classroomName+"</div>");
									};
									var j08 = scheduleByClass.j08;
									if(j08.classId!=0){
										$("#j08").html("<input type = 'hidden' value ='j08-"+j08.scheduleId+"' /><div align ='center' id='courses'>"+j08.courseName+"&nbsp; ("+j08.totalTime+")<br>(1-"+j08.weeks+j08.teacherName+"&nbsp;"+j08.classroomName+"</div>");
									};
									var j09 = scheduleByClass.j09;
									if(j09.classId!=0){
										$("#j09").html("<input type = 'hidden' value ='j09-"+j09.scheduleId+"' /><div align ='center' id='courses'>"+j09.courseName+"&nbsp; ("+j09.totalTime+")<br>(1-"+j09.weeks+j09.teacherName+"&nbsp;"+j09.classroomName+"</div>");
									};
									var j10 = scheduleByClass.j10;
									if(j10.classId!=0){
										$("#j10").html("<input type = 'hidden' value ='j10-"+j10.scheduleId+"' /><div align ='center' id='courses'>"+j10.courseName+"&nbsp; ("+j10.totalTime+")<br>(1-"+j10.weeks+j10.teacherName+"&nbsp;"+j10.classroomName+"</div>");
									};
									var j11 = scheduleByClass.j11;
									if(j11.classId!=0){
										$("#j11").html("<input type = 'hidden' value ='j11-"+j11.scheduleId+"' /><div align ='center' id='courses'>"+j11.courseName+"&nbsp; ("+j11.totalTime+")<br>(1-"+j11.weeks+j11.teacherName+"&nbsp;"+j11.classroomName+"</div>");
									};
									var j12 = scheduleByClass.j12;
									if(j12.classId!=0){
										$("#j12").html("<input type = 'hidden' value ='j12-"+j12.scheduleId+"' /><div align ='center' id='courses'>"+j12.courseName+"&nbsp; ("+j12.totalTime+")<br>(1-"+j12.weeks+j12.teacherName+"&nbsp;"+j12.classroomName+"</div>");
									};
									var j13 = scheduleByClass.j13;
									if(j13.classId!=0){
										$("#j13").html("<input type = 'hidden' value ='j13-"+j13.scheduleId+"' /><div align ='center' id='courses'>"+j13.courseName+"&nbsp; ("+j13.totalTime+")<br>(1-"+j13.weeks+j13.teacherName+"&nbsp;"+j13.classroomName+"</div>");
									};
									var j14 = scheduleByClass.j14;
									if(j14.classId!=0){
										$("#j14").html("<input type = 'hidden' value ='j14-"+j14.scheduleId+"' /><div align ='center' id='courses'>"+j14.courseName+"&nbsp; ("+j14.totalTime+")<br>(1-"+j14.weeks+j14.teacherName+"&nbsp;"+j14.classroomName+"</div>");
									};
									var j15 = scheduleByClass.j15;
									if(j15.classId!=0){
										$("#j15").html("<input type = 'hidden' value ='j15-"+j15.scheduleId+"' /><div align ='center' id='courses'>"+j15.courseName+"&nbsp; ("+j15.totalTime+")<br>(1-"+j15.weeks+j15.teacherName+"&nbsp;"+j15.classroomName+"</div>");
									};
									var j16 = scheduleByClass.j16;
									if(j16.classId!=0){
										$("#j16").html("<input type = 'hidden' value ='j16-"+j16.scheduleId+"' /><div align ='center' id='courses'>"+j16.courseName+"&nbsp; ("+j16.totalTime+")<br>(1-"+j16.weeks+j16.teacherName+"&nbsp;"+j16.classroomName+"</div>");
									};
									var j17 = scheduleByClass.j17;
									if(j17.classId!=0){
										$("#j17").html("<input type = 'hidden' value ='j17-"+j17.scheduleId+"' /><div align ='center' id='courses'>"+j17.courseName+"&nbsp;("+j17.totalTime+")<br>(1-"+j17.weeks+j17.teacherName+"&nbsp;"+j17.classroomName+"</div>");
									};
									var j18 = scheduleByClass.j18;
									if(j18.classId!=0){
										$("#j18").html("<input type = 'hidden' value ='j18-"+j18.scheduleId+"' /><div align ='center' id='courses'>"+j18.courseName+"&nbsp; ("+j18.totalTime+")<br>(1-"+j18.weeks+j18.teacherName+"&nbsp;"+j18.classroomName+"</div>");
									};
									var j19 = scheduleByClass.j19;
									if(j19.classId!=0){
										$("#j19").html("<input type = 'hidden' value ='j19-"+j19.scheduleId+"' /><div align ='center' id='courses'>"+j19.courseName+"&nbsp; ("+j19.totalTime+")<br>(1-"+j19.weeks+j19.teacherName+"&nbsp;"+j19.classroomName+"</div>");
									};
									var j20 = scheduleByClass.j20;
									if(j20.classId!=0){
										$("#j20").html("<input type = 'hidden' value ='j20-"+j20.scheduleId+"' /><div align ='center' id='courses'>"+j20.courseName+"&nbsp; ("+j20.totalTime+")<br>(1-"+j20.weeks+j20.teacherName+"&nbsp;"+j20.classroomName+"</div>");	
									};
									//alert(j01.classId+"-"+j01.classroomId+"-"+j01.teacherId+"-"+j01.courseId);
								});        
						}
					});  
	 		}
	 		var td = $('#data TD').not("#data TD:first-child");
	 		$("#printClassroom").click(function(){//打印
	 			var values="";
	 			if(td[0].innerText==""){
	 				values = "-";
	 			}else{
	 				values = td[0].innerText;
	 			}
	 			for (i = 1; i < 20; i++){
	 				if(td[i].innerText==""){
	 					values +="@!-";
	 				}else{
	 					values += "@!"+td[i].innerText;
	 				}
	 			}

	 			//alert(values);
	 			$("#Print").val(values);
				$("#form2").submit();  
				//var newwin = window.showModelessDialog("ReaderPrint.jsp", 1+","+classroomId+","+classroomName, "dialogTop:500px;dialogWidth:800px;dialogHeight:500px;location=no;resizable:yes; dialogLeft:300px;modal=yes"); 
			});
		});
	</script>

<body leftmargin=20 topmargin=20  bottommargin="1" bgcolor="#DFE8F6">
<form name="form1" id="form1" method="post" action="/schedule/addSchedule" style="margin-bottom:2px">
  <div align="center" id="buttondiv">
  <TABLE id="data" width=100% height=96% border="0" bordercolor="#FF0000" cellspacing="1"  >
    <TR bgcolor="FFFFFF">
       <% Date dt = new Date(); int year =1900+dt.getYear(); %>
      <TH height='15' colspan="6" id=""><label id="scheduleName">湖南文理学院
		<select name='season' id='season'>
			<option><%=year%>年度春（夏）</option>
			<option><%=year%>年度秋（冬）</option>
			<option><%=year+1%>年度春（夏）</option>
			<option><%=year+1%>年度秋（冬）</option>
			<option><%=year+2%>年度春（夏）</option>
			<option><%=year+2%>年度秋（冬）</option>
		</select>
		学期分班课程表</label></TH>
      </TR>
      <TR bgcolor="FFFFFF">
      <TH height='15' colspan="6" id=""><span style="float:left" ><label id="professionalName"></label></span><span style="float:right">教室：<label id="classroomName"></label>&nbsp;&nbsp;&nbsp;</span></TH>
      </TR>
    <TR bgcolor="FFFFFF" height="10%">
      <TH width="10%" height='40' id="">节数/
      星期</TH>
    <TH width="18%">星期一</TH>
    <TH width="18%">星期二</TH>
    <TH width="18%">星期三</TH>
    <TH width="18%">星期四</TH>
    <TH width="18%">星期五</TH>
    </TR>
    <TR id="星期一" bgcolor="FFFFFF" height="15%">
      <TD><div align="center">一二节</div></TD>
      <TD id="j01" align="center"></TD>
      <TD id="j05" align="center"></TD>
      <TD id="j09"></TD>
      <TD id="j13"></TD>
      <TD id="j17"></TD>
    </TR>
    <TR id="星期二" bgcolor="FFFFFF" height="15%">
      <TD><div align="center">三四节</div></TD>
      <TD id="j02"></TD>
      <TD id="j06"></TD>
    <TD id="j10"></TD>
    <TD id="j14"></TD>
    <TD id="j18"></TD>
    </TR>
    <TR id="星期三" bgcolor="FFFFFF" height="15%">
      <TD><div align="center">五六节</div></TD>
      <TD id="j03"></TD>
      <TD id="j07"></TD>
    <TD id="j11"></TD>
    <TD id="j15"></TD>
    <TD id="j19"></TD>
    </TR>
    <TR id="星期四" bgcolor="FFFFFF" height="15%">
      <TD><div align="center">七节</div></TD>
      <TD id="j04"></TD>
      <TD id="j08"></TD>
    <TD id="j12"></TD>
    <TD id="j16"></TD>
    <TD id="j20"></TD>
    </TR>
    <TR bgcolor="FFFFFF" height="10%">
    <% DateFormat df = new SimpleDateFormat("yyyy年MM月dd日"); %>
      <TD colspan="6"><span id="remark"  style="float:left">    备注：1.第8-9节（冬)19:00-20:40  (夏)19:30-21:10</span><span id="time" style="float:right"><%=df.format(new Date())%>   </span></TD>
     </TR>
     <TR bgcolor="FFFFFF" height="10%">
       <TD width=100% colspan="6" align="center">
	  	<!--  <input type="reset" name="reset" id="reset" style="background:#7C97E4" value="重置">  
        <input type="button" style="background:#7C97E4" name="Submit2" id="submit2" value="提交" > -->
        <input type="button" style="background:#7C97E4" name="printClassroom" id ="printClassroom"  value="导出课表" >
       </TD> 
    </TR>
  </TABLE>
  </div>
</form>
<form id="form2" name="form2" method="post" action="./ReaderPrint.jsp">
		<input type="hidden" name="Print" id="Print" >
        <input type="hidden" name="PrintName" id="PrintName" >
        <input type="hidden" name="title" id="title" >
        <input type="hidden" name="printRemark" id="printRemark" >
        <input type="hidden" name="printTime" id="printTime" >
 </form>
<div id="foot" style="background:white;text-align: center;"> </div>
</BODY>
</html>